<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>模块管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../css/x-admin.css" media="all">
		<script src="../js/global.js" type="text/javascript" charset="utf-8"></script>

	</head>

	<body>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
			<legend>系統功能模块维护</legend>
		</fieldset>
		
<div id="divModules" class="demo-tree demo-tree-box" style="width: 100%; height:100%; ">
</div>
				
		<script>
			var treeMethod = {
				addChild: function(obj) {

				},
				updateChild: function(obj) {},
				delChild: function(obj) {
					layer.confirm('确定要删除[' + obj.data.title + ']么', function(index) {
						var data = obj.data; //得到当前节点的数据
						var elem = obj.elem; //得到当前节点元素						
					});
				}
			}
		</script>

<script>
	var treeNode = null;
	var tree, layer, $, form;
	layui.use(['tree', 'layer'], function() {
		tree = layui.tree;
		layer = layui.layer;
		$ = layui.$;
		active = {
			load: function() { //加载当前页
				$.post(globalData.server + "GetAllModuleLayUI", 
				{"token": globalData.myToken},
				function(res) {
					tree.render({
						id: "tv",
						elem: "#divModules",
						data: res,
						edit: ['del','add','update'],								
						click: function(obj) {
							console.log(obj);
							layer.msg("您点击了:"+obj.data.title);
						}
					});
				}, "json");
			}
		};
		active.load();
	});
</script>

	</body>

</html>